Repository navigation
Conversation
…ent (sou1118#63) escape_content escaped every `<` in deleted content except the first argument of `#ref(...)`, so `#cite(<key>)` and `#link(<sec>)[..]` became `\<key>` inside the call, which does not parse. A label is now left alone whenever the Typst parser places it outside markup (an argument at any position, a named argument, a nested call, a binding). Labels in markup, including those inside a content block, and `@ref`s are still escaped. This replaces the `#ref` text heuristic.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deleted content no longer escapes a label literal that is a code argument. Before, only the first argument of
#ref(...)was left alone, so other calls produced output that does not parse:code_label_offsetsparses the fragment withtypst_syntaxand collects theLabelnodes whose parent is notMarkup. Typst parsestext <lbl>and#cite(<key>)as the same node kind, and only the parent tells them apart. This covers any argument position, named arguments, nested calls and#letbindings. It replaces theis_ref_label_argtext check, and#refis now one case of the general rule. Labels in markup, including those inside a content argument (#link(<sec>)[see <lbl>]), and@refs are still escaped.Tests: two unit tests (code labels at any position left alone; markup labels,
@refanda < bstill escaped) and three integration tests (#cite,#linkand the markup-label case), each checking the exact output and that it parses.cargo fmt --check,cargo clippy -- -D warnings,cargo testand both compile-test fixtures pass.Fixes #63